// ref: https://umijs.org/config/
import routes from './router.config';
import { primaryColor } from '../src/defaultSettings';

export default {
  plugins: [
    [
      'umi-plugin-react', {
        antd: true,
        dva: {
          hmr: true,
        },
        targets: {
          ie: 11,
        },
        locale: {
          enable: true, // default false
          default: 'zh-CN', // default zh-CN
          baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
        },
        dynamicImport: {
          loadingComponent: './components/PageLoading/index'
        },
        // dynamicImport: false,
        // hd: true,
      },
    ],
    [
      'umi-plugin-pro-block', {
        moveMock: false,
        moveService: false,
        modifyRequest: true,
        autoAddMenu: true,
      },
    ],
  ],
  targets: {
    ie: 11,
  },

  /**
   * 路由相关配置
   */
  routes,
  disableRedirectHoist: true,
  proxy: {
    '/clover/api/': {
      target: 'http://127.0.0.1:7001',
      changeOrigin: true,
      pathRewrite: { '^/clover': '' },
    },
    '/public/': {
      target: 'http://clover.oss.w3cshare.cn',
      changeOrigin: true,
      pathRewrite: { '^/public': '/public/' },
    },
    '/geocoder/': {
      target: 'http://127.0.0.1:3000',
    },
  },
  // history: 'hash',
  hash: true,
  /**
   * webpack 相关配置
   */
  define: {
    APP_TYPE: process.env.APP_TYPE || '',
    API_PREFIX: `/clover/api/v1/access`,
    TITLE: '幸运草小程序',
    LOGO: '/public/logo.png',
    IMAGE_STYLE: ',image/auto-orient,1/quality,q_90/watermark,image_cHVibGljL2xvZ28ucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2UvcmVzaXplLFBfMjA,x_10,y_10',
  },
  // publicPath: 'http://clover.oss.w3cshare.cn/ldy',
  // base: '/ldygo_ticket/Public/Home/',
  // publicPath: '/ldygo_ticket/Public/Home/',
  // cssPublicPath: '/ldygo_ticket/Public/Home/',
  // Theme for antd
  // https://ant.design/docs/react/customize-theme-cn
  theme: {
    'primary-color': primaryColor,
  },
  externals: {
    '@antv/data-set': 'DataSet',
  },
  ignoreMomentLocale: true,
  lessLoaderOptions: {
    javascriptEnabled: true,
  },
};